import cx_Oracle
import os
from auto_interface.testting import rpb_all_param
import datetime
# os.environ['NLS_LANG'] = 'SIMPLIFIED CHINESE_CHINA.UTF8'
class Oracle_conn():
    @classmethod
    def select(self, sql, orcle_adress=rpb_all_param.Param.orcle_adress):
        conn = cx_Oracle.connect(orcle_adress)
        print(sql)
        c = conn.cursor()
        c.execute(sql)
        value = c.fetchone()
        c.close()
        conn.close()
        if value is None:
            return ''
        print('8888888888888888')
        print(value[0])
        return value[0]



    @classmethod
    def update(self, sql, orcle_adress=rpb_all_param.Param.orcle_adress):
        print(sql)
        conn = cx_Oracle.connect(orcle_adress)
        c = conn.cursor()
        c.execute(sql)
        if c.rowcount < 1:
            print('参数有误，需核对')
        # print(c.rowcount)
        c.close()
        conn.commit()
        conn.close()
if __name__ == "__main__":
    Oracle_conn().update("update TB_CAR_LOG set EX_TIME = to_date('2023-02-10 16:06:23','yyyy-MM-dd hh24:mi:ss') where SEQ_NUMBER = 107455949")
